Fix Azure Monitor API timespan format to use 'Z' for UTC#1005
Merged
Conversation
Azure Monitor API requires timespan to use 'Z' suffix for UTC timezone
instead of '+00:00' offset. Changed from datetime.isoformat() to
strftime('%Y-%m-%dT%H:%M:%SZ') to match Azure's expected ISO 8601 format.
This fixes the BadRequest error: "Detected invalid time interval input"
that was occurring in instance_idle and unused_nat_gateway policies.
Files modified:
- cloud_governance/common/clouds/azure/monitor/monitor_management_operations.py
- cloud_governance/policy/helpers/azure/azure_policy_operations.py
Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughFour single-line changes replace ChangesAzure Monitor UTC timespan formatting
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Note: Fill x in []
Description
Azure Monitor API requires timespan to use 'Z' suffix for UTC timezone instead of '+00:00' offset. Changed from datetime.isoformat() to strftime('%Y-%m-%dT%H:%M:%SZ') to match Azure's expected ISO 8601 format.
This fixes the BadRequest error: "Detected invalid time interval input" that was occurring in instance_idle and unused_nat_gateway policies.
For security reasons, all pull requests need to be approved first before running any automated CI